package club.zhaoliang.study.webservice;

import com.yanzhenjie.andserver.annotation.GetMapping;
import com.yanzhenjie.andserver.annotation.PostMapping;
import com.yanzhenjie.andserver.annotation.RequestMapping;
import com.yanzhenjie.andserver.annotation.RequestParam;
import com.yanzhenjie.andserver.annotation.RestController;

@RestController
@RequestMapping(path = "/user")
public class UserController {

    @PostMapping("/login")
    public String login(@RequestParam("account") String account,
                        @RequestParam("password") String password) {
        return "Successful."+account+" "+password;
    }


    @GetMapping(path = "/info")
    public String modify() {
        return "hello AndServer";
    }

//    @GetMapping(path = "/{userId}")
//    public User info(@PathVariable("userId") String userId,
//                     @QueryParam("fields") String fields) {
//
//        User user = null;
//        return user;
//    }
//
//    @PutMapping(path = "/{userId}")
//    public void modify(@PathVariable("userId") String userId, @RequestParam("age") int age) {
//    }


    private class User {

    }
}